package cn.dengta.webapp.im.enums;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.common.model.ValueProxyImpl;
import cn.dengta.common.util.Common;
import cn.dengta.context.model.ImI18nKey;
import cn.dengta.context.model.MessagerStatus;
import lombok.Getter;

@Getter
public enum GroupUseStatus implements ValueProxyImpl<GroupUseStatus, Integer> {

	DISABLE(0, "禁用", MessagerStatus.GROUP_DISABLE, ImI18nKey.GROUP_DISABLE),
	ENABLED(1, "启用", null, null),
	DISSOLVE(-1, "解散", MessagerStatus.GROUP_DISSOLVE, ImI18nKey.GROUP_DISSOLVE);

	public final Integer value;
	String label;
	String status;
	String msg;
	final ValueProxy<GroupUseStatus, Integer> proxy;

	GroupUseStatus(Integer value, String label, String status, String msg) {
		this.value = value;
		this.label = label;
		this.status = status;
		this.msg = msg;
		this.proxy = new ValueProxy<>(this, value, label);
	}

	public static final GroupUseStatus[] CACHE = values();

	public static GroupUseStatus of(final int val) {
		return Common.getEnum(CACHE, GroupUseStatus::getValue, val);
	}

	public static String getLabel(final int val) {
		final GroupUseStatus status = of(val);
		return status == null ? null : status.getLabel();
	}

}
